package com.xin.di.uav.applet.mapper;

import com.xin.di.uav.user.order.po.Product;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Select({"<script>",
            "select id,name,main_image,sale_price,stock,merchant_id from product where status=1 and merchant_id in  " +
                    "<foreach collection='merchantIds' item='merchantId' open='(' close=')' separator=','>",
            "#{merchantId}",
            "</foreach>",
                    " and stock>0 order by  sort asc ",
            "</script>"})
    List<Product> selectListOrderBySort(@Param("offset") int offset, @Param("pageSize") int pageSize,@Param("merchantIds") List<String> merchantIds);
}
